﻿<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="Хранилище VinidiktovDay5Model" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
  <EntityType Name="CategoryProduct">
    <Key>
      <PropertyRef Name="ID_Category" />
    </Key>
    <Property Name="ID_Category" Type="int" Nullable="false" />
    <Property Name="Name" Type="nvarchar" MaxLength="50" Nullable="false" />
  </EntityType>
  <EntityType Name="ManufactureProduct">
    <Key>
      <PropertyRef Name="ID_Manufacturer" />
    </Key>
    <Property Name="ID_Manufacturer" Type="int" Nullable="false" />
    <Property Name="Name" Type="nvarchar" MaxLength="50" Nullable="false" />
  </EntityType>
  <EntityType Name="Order">
    <Key>
      <PropertyRef Name="ID_Order" />
    </Key>
    <Property Name="ID_Order" Type="int" Nullable="false" />
    <Property Name="ID_StatusOrder" Type="int" Nullable="false" />
    <Property Name="DateOrder" Type="date" Nullable="false" />
    <Property Name="DateDelivery" Type="date" Nullable="false" />
    <Property Name="ID_CompositionOrder" Type="int" Nullable="false" />
    <Property Name="CountProduct" Type="int" Nullable="false" />
    <Property Name="ID_PickUp" Type="int" Nullable="false" />
    <Property Name="ID_Client" Type="int" />
    <Property Name="CodeReceive" Type="int" Nullable="false" />
  </EntityType>
  <EntityType Name="OrderProduct">
    <Key>
      <PropertyRef Name="ID_OrderProduct" />
    </Key>
    <Property Name="ID_OrderProduct" Type="int" Nullable="false" />
    <Property Name="ID_Order" Type="int" />
    <Property Name="ID_Product" Type="int" Nullable="false" />
  </EntityType>
  <EntityType Name="PickUpPoint">
    <Key>
      <PropertyRef Name="ID_PickUp" />
    </Key>
    <Property Name="ID_PickUp" Type="int" Nullable="false" />
    <Property Name="Address" Type="nvarchar" MaxLength="300" />
  </EntityType>
  <EntityType Name="Product">
    <Key>
      <PropertyRef Name="ID_Product" />
    </Key>
    <Property Name="ID_Product" Type="int" Nullable="false" />
    <Property Name="Articul" Type="nvarchar" MaxLength="50" Nullable="false" />
    <Property Name="Name" Type="nvarchar" MaxLength="50" Nullable="false" />
    <Property Name="DescriptionProduct" Type="nvarchar" MaxLength="200" Nullable="false" />
    <Property Name="ID_Category" Type="int" Nullable="false" />
    <Property Name="Photo" Type="nvarchar" MaxLength="1000" />
    <Property Name="ID_Manufacture" Type="int" Nullable="false" />
    <Property Name="Cost" Type="int" Nullable="false" />
    <Property Name="CurrentDiscount" Type="int" Nullable="false" />
    <Property Name="MaxDiscount" Type="int" Nullable="false" />
    <Property Name="QuantityStock" Type="int" Nullable="false" />
    <Property Name="ID_UnitMeasurement" Type="int" Nullable="false" />
    <Property Name="ID_Supplier" Type="int" Nullable="false" />
  </EntityType>
  <EntityType Name="Role">
    <Key>
      <PropertyRef Name="ID_Role" />
    </Key>
    <Property Name="ID_Role" Type="int" Nullable="false" />
    <Property Name="Role" Type="nvarchar" MaxLength="50" Nullable="false" />
  </EntityType>
  <EntityType Name="StatusOrder">
    <Key>
      <PropertyRef Name="ID_Status" />
    </Key>
    <Property Name="ID_Status" Type="int" Nullable="false" />
    <Property Name="Status" Type="nvarchar" MaxLength="50" Nullable="false" />
  </EntityType>
  <EntityType Name="Supplier">
    <Key>
      <PropertyRef Name="ID_Supplier" />
    </Key>
    <Property Name="ID_Supplier" Type="int" Nullable="false" />
    <Property Name="Name" Type="nvarchar" MaxLength="50" Nullable="false" />
  </EntityType>
  <EntityType Name="UnitMeasurement">
    <Key>
      <PropertyRef Name="ID_UnitMeasurement" />
    </Key>
    <Property Name="ID_UnitMeasurement" Type="int" Nullable="false" />
    <Property Name="Name" Type="nvarchar" MaxLength="50" Nullable="false" />
  </EntityType>
  <EntityType Name="Users">
    <Key>
      <PropertyRef Name="ID_User" />
    </Key>
    <Property Name="ID_User" Type="int" Nullable="false" />
    <Property Name="FIO" Type="nvarchar" MaxLength="50" Nullable="false" />
    <Property Name="Login" Type="nvarchar" MaxLength="50" Nullable="false" />
    <Property Name="Password" Type="nvarchar" MaxLength="50" Nullable="false" />
    <Property Name="ID_Role" Type="int" Nullable="false" />
  </EntityType>
  <!--Ошибки, обнаруженные при создании:
предупреждение 6002: В таблице или представлении "VinidiktovDay5.dbo.InfoProduct" не определен первичный ключ. Ключ был выведен, а определение таблицы или представления было создано в режиме только для чтения.-->
  <EntityType Name="InfoProduct">
    <Key>
      <PropertyRef Name="ID_Product" />
      <PropertyRef Name="Name" />
      <PropertyRef Name="DescriptionProduct" />
      <PropertyRef Name="Manufacture" />
      <PropertyRef Name="Cost" />
      <PropertyRef Name="QuantityStock" />
    </Key>
    <Property Name="ID_Product" Type="int" Nullable="false" />
    <Property Name="Name" Type="nvarchar" MaxLength="50" Nullable="false" />
    <Property Name="DescriptionProduct" Type="nvarchar" MaxLength="200" Nullable="false" />
    <Property Name="Manufacture" Type="nvarchar" MaxLength="50" Nullable="false" />
    <Property Name="Cost" Type="int" Nullable="false" />
    <Property Name="QuantityStock" Type="int" Nullable="false" />
    <Property Name="Photo" Type="nvarchar" MaxLength="50" />
  </EntityType>
  <Association Name="FK_Order_PickUpPoint">
    <End Role="PickUpPoint" Type="Self.PickUpPoint" Multiplicity="1" />
    <End Role="Order" Type="Self.Order" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="PickUpPoint">
        <PropertyRef Name="ID_PickUp" />
      </Principal>
      <Dependent Role="Order">
        <PropertyRef Name="ID_PickUp" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK_Order_StatusOrder">
    <End Role="StatusOrder" Type="Self.StatusOrder" Multiplicity="1" />
    <End Role="Order" Type="Self.Order" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="StatusOrder">
        <PropertyRef Name="ID_Status" />
      </Principal>
      <Dependent Role="Order">
        <PropertyRef Name="ID_StatusOrder" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK_Order_Users">
    <End Role="Users" Type="Self.Users" Multiplicity="0..1" />
    <End Role="Order" Type="Self.Order" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Users">
        <PropertyRef Name="ID_User" />
      </Principal>
      <Dependent Role="Order">
        <PropertyRef Name="ID_Client" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK_OrderProduct_Order">
    <End Role="Order" Type="Self.Order" Multiplicity="0..1" />
    <End Role="OrderProduct" Type="Self.OrderProduct" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Order">
        <PropertyRef Name="ID_Order" />
      </Principal>
      <Dependent Role="OrderProduct">
        <PropertyRef Name="ID_Order" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK_OrderProduct_Product">
    <End Role="Product" Type="Self.Product" Multiplicity="1" />
    <End Role="OrderProduct" Type="Self.OrderProduct" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Product">
        <PropertyRef Name="ID_Product" />
      </Principal>
      <Dependent Role="OrderProduct">
        <PropertyRef Name="ID_Product" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK_Product_CategoryProduct">
    <End Role="CategoryProduct" Type="Self.CategoryProduct" Multiplicity="1" />
    <End Role="Product" Type="Self.Product" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="CategoryProduct">
        <PropertyRef Name="ID_Category" />
      </Principal>
      <Dependent Role="Product">
        <PropertyRef Name="ID_Category" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK_Product_ManufactureProduct">
    <End Role="ManufactureProduct" Type="Self.ManufactureProduct" Multiplicity="1" />
    <End Role="Product" Type="Self.Product" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="ManufactureProduct">
        <PropertyRef Name="ID_Manufacturer" />
      </Principal>
      <Dependent Role="Product">
        <PropertyRef Name="ID_Manufacture" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK_Product_Supplier">
    <End Role="Supplier" Type="Self.Supplier" Multiplicity="1" />
    <End Role="Product" Type="Self.Product" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Supplier">
        <PropertyRef Name="ID_Supplier" />
      </Principal>
      <Dependent Role="Product">
        <PropertyRef Name="ID_Supplier" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK_Product_UnitMeasurement">
    <End Role="UnitMeasurement" Type="Self.UnitMeasurement" Multiplicity="1" />
    <End Role="Product" Type="Self.Product" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="UnitMeasurement">
        <PropertyRef Name="ID_UnitMeasurement" />
      </Principal>
      <Dependent Role="Product">
        <PropertyRef Name="ID_UnitMeasurement" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <Association Name="FK_Users_Role">
    <End Role="Role" Type="Self.Role" Multiplicity="1" />
    <End Role="Users" Type="Self.Users" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Role">
        <PropertyRef Name="ID_Role" />
      </Principal>
      <Dependent Role="Users">
        <PropertyRef Name="ID_Role" />
      </Dependent>
    </ReferentialConstraint>
  </Association>
  <EntityContainer Name="Хранилище VinidiktovDay5ModelContainer">
    <EntitySet Name="CategoryProduct" EntityType="Self.CategoryProduct" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="ManufactureProduct" EntityType="Self.ManufactureProduct" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Order" EntityType="Self.Order" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="OrderProduct" EntityType="Self.OrderProduct" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="PickUpPoint" EntityType="Self.PickUpPoint" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Product" EntityType="Self.Product" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Role" EntityType="Self.Role" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="StatusOrder" EntityType="Self.StatusOrder" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Supplier" EntityType="Self.Supplier" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="UnitMeasurement" EntityType="Self.UnitMeasurement" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="Users" EntityType="Self.Users" Schema="dbo" store:Type="Tables" />
    <EntitySet Name="InfoProduct" EntityType="Self.InfoProduct" store:Type="Views" store:Schema="dbo">
      <DefiningQuery>SELECT 
    [InfoProduct].[ID_Product] AS [ID_Product], 
    [InfoProduct].[Name] AS [Name], 
    [InfoProduct].[DescriptionProduct] AS [DescriptionProduct], 
    [InfoProduct].[Manufacture] AS [Manufacture], 
    [InfoProduct].[Cost] AS [Cost], 
    [InfoProduct].[QuantityStock] AS [QuantityStock], 
    [InfoProduct].[Photo] AS [Photo]
    FROM [dbo].[InfoProduct] AS [InfoProduct]</DefiningQuery>
    </EntitySet>
    <AssociationSet Name="FK_Order_PickUpPoint" Association="Self.FK_Order_PickUpPoint">
      <End Role="PickUpPoint" EntitySet="PickUpPoint" />
      <End Role="Order" EntitySet="Order" />
    </AssociationSet>
    <AssociationSet Name="FK_Order_StatusOrder" Association="Self.FK_Order_StatusOrder">
      <End Role="StatusOrder" EntitySet="StatusOrder" />
      <End Role="Order" EntitySet="Order" />
    </AssociationSet>
    <AssociationSet Name="FK_Order_Users" Association="Self.FK_Order_Users">
      <End Role="Users" EntitySet="Users" />
      <End Role="Order" EntitySet="Order" />
    </AssociationSet>
    <AssociationSet Name="FK_OrderProduct_Order" Association="Self.FK_OrderProduct_Order">
      <End Role="Order" EntitySet="Order" />
      <End Role="OrderProduct" EntitySet="OrderProduct" />
    </AssociationSet>
    <AssociationSet Name="FK_OrderProduct_Product" Association="Self.FK_OrderProduct_Product">
      <End Role="Product" EntitySet="Product" />
      <End Role="OrderProduct" EntitySet="OrderProduct" />
    </AssociationSet>
    <AssociationSet Name="FK_Product_CategoryProduct" Association="Self.FK_Product_CategoryProduct">
      <End Role="CategoryProduct" EntitySet="CategoryProduct" />
      <End Role="Product" EntitySet="Product" />
    </AssociationSet>
    <AssociationSet Name="FK_Product_ManufactureProduct" Association="Self.FK_Product_ManufactureProduct">
      <End Role="ManufactureProduct" EntitySet="ManufactureProduct" />
      <End Role="Product" EntitySet="Product" />
    </AssociationSet>
    <AssociationSet Name="FK_Product_Supplier" Association="Self.FK_Product_Supplier">
      <End Role="Supplier" EntitySet="Supplier" />
      <End Role="Product" EntitySet="Product" />
    </AssociationSet>
    <AssociationSet Name="FK_Product_UnitMeasurement" Association="Self.FK_Product_UnitMeasurement">
      <End Role="UnitMeasurement" EntitySet="UnitMeasurement" />
      <End Role="Product" EntitySet="Product" />
    </AssociationSet>
    <AssociationSet Name="FK_Users_Role" Association="Self.FK_Users_Role">
      <End Role="Role" EntitySet="Role" />
      <End Role="Users" EntitySet="Users" />
    </AssociationSet>
  </EntityContainer>
</Schema>